home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6199 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1017 b   |  32 lines

  1. Path: ix.netcom.com!patriot
  2. From: greinerk@ix.netcom.com (Kurt W. Greiner)
  3. Newsgroups: comp.lang.c++
  4. Subject: cin.get(string) problem
  5. Date: Sun, 11 Feb 96 05:48:44 GMT
  6. Organization: The ESCape Club
  7. Message-ID: <4fk02a$nh@reader2.ix.netcom.com>
  8. NNTP-Posting-Host: ix-clv4-10.ix.netcom.com
  9. X-NETCOM-Date: Sat Feb 10  9:50:04 PM PST 1996
  10. X-Newsreader: News Xpress 2.0 Beta #0
  11.  
  12. Hi all,
  13.         i was trying some really simple io for a program that just gets 
  14. values, here is a sample of code
  15.  
  16. #include <iostream.h>
  17.  
  18. void main(void)
  19. {
  20.         char string[80];
  21.         cin.get(string,sizeof(string));
  22.         cin.get(string,sizeof(string));
  23. }
  24.  
  25. ok, say i want to read in a name on the first cin, i type in "john smith" and 
  26. the prompt, john gets thrown in to the first and smith the second, i do not 
  27. even get prompted for the second cin. it does not happen if i type in a string 
  28. with out spaces. i am using borland c++ 2.0, am i doing something wrong or is 
  29. there an other way of doing this other than gets(string)?
  30.  
  31. kurt
  32.